/*
* Copyright (c) 2007 by Kirill Kolodyazhniy.
* See the file "license.terms" for information on usage and redistribution.
*/

#include "root.h"

using namespace Engine;

template<> Root* Singleton<Root>::m_singleton = 0;

int WINAPI WinMain(HINSTANCE,HINSTANCE,LPSTR,int)
{
#ifdef _MSC_VER
#ifdef _DEBUG
	int tmpFlag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
	tmpFlag |= _CRTDBG_LEAK_CHECK_DF;
	_CrtSetDbgFlag( tmpFlag );
#endif
#endif

	try
	{
		RefPtr<Root> root(new Root());
		root->Run();
	}
	catch(std::exception& e)
	{
		MessageBox(NULL,e.what(),"Exception",MB_OK|MB_ICONERROR);
	}
	catch(...)
	{
		MessageBox(NULL,"Unknown error","Exception",MB_OK|MB_ICONERROR);
	}
	return 0;
}
